package labox.innovation.gameserver.timer;

import java.util.*;
import java.util.concurrent.PriorityBlockingQueue;

public class TimerTask {
	/** */
	/** 定时器事件队列 */
	//Queue<Timer> queue_ = new PriorityQueue<Timer>(20000);
	
	Queue<Timer> queue_ = new PriorityBlockingQueue<Timer>(20000);

	/** */
	/** Creates a new instance of TimerTask */
	public TimerTask() {
	}

	/** */
	/** 设置定时器，并放入队列 */
	public void put(Timer t, Object param) {
		queue_.offer(t);
	}

	/** */
	/** 去掉指定的定时器 */
	protected void remove(Timer timer) {
		queue_.remove(timer);
	}

	/** */
	/** 关闭操作 */
	public void close() {
		queue_.clear();
	}

	public Timer peek() {
		return queue_.peek();
	}

	public Timer poll() {
		return queue_.poll();
	}

	public int size() {
		return queue_.size();
	}

}
